


Factorization

by Bitenomnom



Series: Mathematical Proof [22]
Category: Sherlock (TV)
Genre: Friendship, Gen, Humor, John does the same, M/M, Mathematics, Sherlock talks to John when John's not there, also with optional humorous ending, friendship with optional johnlock ending
Language: English
Status: Completed
Published: 2012-10-12
Updated: 2012-10-12
Packaged: 2017-11-16 03:44:26
Rating: Not Rated
Warnings: Creator Chose Not To Use Archive Warnings
Chapters: 1
Words: 2,433
Publisher: archiveofourown.org
Story URL: https://archiveofourown.org/works/535112
Author URL: https://archiveofourown.org/users/Bitenomnom/pseuds/Bitenomnom
Summary: <blockquote class="userstuff">
              <p>“Too many variables, John,” Sherlock said. He did not, in fact, say this to John. John was at the grocery. John had been at the grocery for the past forty-five minutes. 	This case was unusual in that it involved three separate people who had each apparently committed the same murder independently of one another.</p>
<p>But that wasn’t what was important right now.</p>
<p>What was important right now was that John was being a git, having the nerve to not actually be there at 221B while Sherlock talked to him. He was also being very argumentative.</p>
            </blockquote>





	Factorization

**Author's Note:**

> Okay, so, two alternate endings: one for Johnlock people, one for anyone who would rather read this as a friendship story. Or just enjoy being misled. XD
> 
> Yesterday's lack of story was due to my class being cancelled. Also, my fall break ("break," psh, barely) is Monday and Tuesday next week, so also don't expect stories in this series for those days. (However, I may be posting other stuff -- a different drabble, or else possibly a new chapter of [The Case of the Moebius Trip](http://archiveofourown.org/works/446714/chapters/764488) \-- in the meantime.)

In solving systems of linear equations, one often utilizes matrices. However, some problems can become extremely complicated, since this method generally requires finding the inverse of a very large matrix (which takes a lot of time and computing power once the matrix exceeds a certain size, and is an unstable computation). One solution to this problem is to factorize the matrix, which allows us to find the inverse of the matrix using fewer computations (making it much faster).

 

For instance, one can use LU factorization, which involves breaking up a matrix into two separate matrices: one that’s a lower triangular matrix, L, where all the values are in the bottom-left in the matrix up through the diagonal, and one that’s an upper triangular matrix, U (values in the top-right). Gaussian elimination can be used to simplify the system and acquire the appropriate matrices. Sometimes additional measures have to be taken to ensure that the computations when solving for variables in Gaussian elimination are accurate—such as “partial pivoting,” where rows are exchanged to accommodate differences in magnitude of values from row to row, and “scaled partial pivoting,” which is used in instances where there are large differences in magnitude in the same row.

 

The in generating the L and U matrices for LU factorization, one winds up with n2 \+ n unknowns (for an matrix of size n x n). But, the setup provides for only n2 equations, meaning we have to choose n unknowns to make up for the difference and ensure our solution is unique. There are three very popular factorizations commonly used to this end: Doolittle’s factorization, Crout’s factorization, and the Cholesky factorization. In Doolittle’s factorization, L is unit triangular (that is, all the diagonal spots on the L matrix are 1’s). In Crout’s factorization, you select U to be unit upper triangular (ones in the diagonals). In the Cholesky factorization, you add the restriction that each diagonal entry in L matches up with the same diagonal entry in U. (However, this last one doesn’t always exist; for instance, if the determinant of the main matrix is negative.)

 

These methods are all used to make our lives easier when solving systems of linear equations, which, when performed using matrices, requires that the matrix for your equations be invertible. They are developed because a matrix inverse is usually a pain to calculate for big matrices.

 

 

 

***

 

 

            “Too many variables, John,” Sherlock said. He did not, in fact, say this to John. John was at the grocery. John had been at the grocery for the past forty-five minutes.

            “No, I _don’t_ need an organization system,” he said. “That’s my _brain_. For god’s sake, it’s not my fault you can’t use yours that way.” John had foolishly suggested some sort of organized way of simplifying the problem. Except that John hadn’t actually suggested such a thing, because he was, again, at the grocery. But it was something that he _would_ suggest, wasn’t it?       

            As if Sherlock couldn’t organize and simplify the problem no matter how out of hand it got for _ordinary_ people.

            This case was unusual in that it involved three separate people who had each apparently committed the same murder independently of one another. They had also all _confessed_ independently of one another, each telling different but feasible stories.

            But that wasn’t what was important right now.

            What was important right now was that John was being a git, having the nerve to not actually be there at 221B while Sherlock talked to him. He was also being very argumentative.

            “No, I won’t just _give it a try_. It’d be a waste of my time.”

            Sherlock paced briskly about the sitting room. Of course the skull wasn’t talking to him at _all_ nowadays. Probably jealous. Sherlock scoffed. “Yes, the silent treatment, how mature of you.”

            The skull said nothing.

            He vaguely recalled John having said something to him before leaving, something that he was supposed to do. Probably John wanted him to mop up the ocular fluids that had dripped out of the baggies that had been rather roughly shoved to the back of the refrigerator. “Honestly, you should know better.”

            Or maybe it had been the same ‘organize your thoughts like this; oh, you could look at these events separately, you should chart it out’ suggestion like the ones John-not-John had been making-not-making for the past half-hour. Oh, yes, that was it: because John had brought out the bulletin board that Sherlock hadn’t felt the need to use since when Moriarty started playing games with him. He had stacked up a pile of sticky notes, a box of thumbtacks, and three differently colored pens he’d fetched from god-knew-where on top of it, and placed the whole ensemble on the table before marching out.

            “Just try to pin something down,” he’d said, and he also said just now, in the flat, while he was at the grocery store. Oh, John, that—

            _Oh._

            Yes, yes, pin something down.

            Theorizing before gathering all the evidence was poor practice, but he had gathered, he suspected, almost all the evidence there was to be gathered. He could just form a few separate, objective theories based on assuming different things about different parts of the evidence.

            For instance, he could assume that the first of the suspects, Doolittle, was actually the murderer, and carry on from there. Then he could to the same for Crout and Cholesky, the other two. _Assume it was not a coincidence that Cholesky and the victim had the same distribution of notes in their wallets. What then? Assume it is relevant that Doolittle’s place of business was located diagonally across the street from Crout’s favorite restaurant. What then?_

Then…

            Then…

            _Ohh._

Yes. That was it—he needed to pop by the restaurant. “No, I’m not admitting anything,” he told John as he grabbed his coat. “Well, I’m out,” he said as he approached the threshold. “Get some Chinese take-out while I’m gone; I’ll only be a couple hours.”

 

 

 

            Of _course_ Sherlock wasn’t there when John returned with groceries.

            And of _course_ he hadn’t cleaned out his mess in the refrigerator. “Wouldn’t want to make things too easy on me, would you?” John asked Sherlock—or rather, John asked no one in particular, as Sherlock had been gone from the flat for the past forty-five minutes.

            No, Sherlock-Bloody-Holmes was apparently entitled to a servant to do such menial tasks for him as prevent him from dying of food poisoning, or prevent him from dying of starvation. “No, Sherlock, thanks, I think I qualify as a professional appliance sanitizer now,” he mumbled. “That’s a great favor you’ve done me as I’m otherwise completely unemployable. Oh, wait, I’m _still_ completely unemployable, thanks to _somebody._ ”

            Not that he minded, per se—and there was actually plenty of locum work to be found—but John did wonder off and on if Sherlock intentionally arranged things so that John stood an ice cube’s chance in hell of getting a regular job. He was thankful for the excuse, really—most aspects of _regular job_ were unappealing to John—but he did feel pretty useless, occasionally having to skip out on a portion of a month’s rent because they’d been busy on cases for so much of the month that John hadn’t done a speck of work. Sherlock obviously didn’t care, and would argue that John contributed to the work that he did and therefore earned part of what some of their clients paid them, but as far as John was concerned, he was mostly responsible for following Sherlock around with a gun to make sure he didn’t himself killed by either thugs or some Yarder he inevitably offended. He’d contribute a “she’s been dead for six to eight hours,” and Sherlock would say, _oh, of course, I already knew that because her keys were sitting on the kitchen table_ or some such.

            “You do this to me on purpose, don’t you?” John muttered as he crouched in front of the open refrigerator to survey the damage. It was almost certainly _not worth it_. Perhaps he could devise some way to bribe Sherlock to do it. Tell Greg that Sherlock was far too busy cleaning to take any new cases for the next week or three? That might do; then again, they got plenty of clients from Sherlock’s website, so it probably wasn’t enough of a sting. Invite Mycroft over for dinner? No, no, that was _too_ low.

            Maybe positive reinforcement was the way to go. Perhaps, if there was anything he could offer to Sherlock to convince him…well, no. Sherlock obviously wouldn’t care to know about _that_.

            John put away what of the food belonged in cabinets or in reasonably safe areas of the refrigerator. It was almost empty, so there was room for most of it, but…well, he’d just leave it to Sherlock to wonder what the eggs he’d requested (mysteriously vehemently) were doing in the freezer.

            He meandered back to the sitting area. “Oh, I see you didn’t even use the stuff I got out,” he said to Sherlock-not-Sherlock. “What a surprise.” Sherlock-not-Sherlock was silent and stubborn about the matter, which was at least better than noisy and stubborn about the matter. John would have to get up and put the unused supplies away later this evening.

            Now, though, he could do with a good nap.

 

 

 

            “…And I _told_ you to pick up Chinese,” was what John woke to an hour later.

            “No you didn’t,” he shouted toward the kitchen as he rubbed the sleep from his eyes.

            “Oh! John! You’re here!”

            “Obviously,” John said. “I figured you knew, since you were talking to me and all.”

            “Oh, I wasn’t talking to _you,_ ” Sherlock entered the sitting room to stand across from John. “I mean, of course I was talking to you, but—”

            “Yeah, yeah, okay,” John waved him off. “By the way, no thanks to you for dashing off without cleaning out the, er, fluids in the refrigerator.”

            “You did so, then?” Sherlock had moved on to pacing, pressing his fingertips together.

            “Of course I bloody didn’t!” John huffed. “That’s _your_ mess and _you’re_ cleaning it. What was so urgent that you ran off without texting me, anyway?”

            Sherlock stopped abruptly and turned on his toes. “A breakthrough, John!”

            “Oh?”

            “Lestrade is arresting all three suspects as we speak.”

            “So…they all…?”

            “I’ll explain it in a moment,” Sherlock whisked off to the kitchen and returned with take-out boxes.

            “I thought you said you asked me to get it?” John took his, dazed.

            “I knew I didn’t really ask _you_ ,” Sherlock threw himself into his chair. John was surprised to see that Sherlock had gotten some for himself, too—so the case _was_ closed, then. “Honestly, John. I’m not an _idiot_.”

            “You just pretend to talk to me while I’m gone.”

            “The skull has been rather unhelpful of late.”

            John rolled his eyes at Sherlock and dug into his dinner.

            “Don’t tell me you don’t talk to other people while you’re alone,” Sherlock raised his eyebrows.

            “Of course not,” John said between bites. “That’s ridiculous.”

            The corner of Sherlock’s mouth turned down in disbelief, but he appeared to be attempting to restrain himself. Instead, he took a few bites, and after the continued silence, asked, “So, what do I get?”

            “A gold medal, congrats,” John said dryly, and then, “For _what_?”

            Sherlock sighed theatrically. “Dinner, John. I picked up dinner even though you didn’t ask me to.”

            “Well, I got the groceries without being told, but if you’ll notice, I’m not requesting a trophy.”

            “That’s because you’re _you_ , John,” Sherlock answered. “You just _do_ those things.”  
            “Right, whereas you need positive reinforcement.”

            His face lit up. “Exactly!”

            “Sounds like you’re just looking to get favors from me,” John sighed, setting his food aside to get up and fetch some tea. When he turned back to Sherlock, Sherlock was pouting, apparently hurt that John would suggest such a thing. “Right, you agree to _actually_ clean the refrigerator out, and then we’ll talk.”

            “I can do that. I’ll do it after we finish eating.”

            John froze in his tracks. “Okay, Sherlock, _what_ is it that you want from me in exchange?”

            “I did use your advice, in the end,” Sherlock said instead.

            John could only sigh and turn to face Sherlock. Such complete shifts in topic were so common in conversation with Sherlock that John had to make an effort to register how odd they were. Usually, he didn’t bother. “That so?”

            “Yes,” he said, setting down his chopsticks. “Pinning certain things down.”

            “Huh,” John smirked. “See, not so useless a—” he stopped abruptly upon observing Sherlock’s facial expression. “Er…” He took in a deep breath. “This is somehow related to what you want out of me, isn’t it?”

            “ _Positive reinforcement,_ John,” Sherlock reminded him, his own smirk growing as John’s shrank. “Would you be averse to various other experiments relating to _pinning_?”

            John absently took a sip of his tea, apparently forgetting how hot it still was. “What exactly…”

            Sherlock retrieved a small case from beneath a stack of papers.

            “Exactly what you think I mean, John,” he said. John’s eyes fixed on the box and his mouth twitched as he strained to appear as if he didn’t recognize it. “Don’t bother,” Sherlock said. “I found your… _collection_.” 1, 2

1 Sexy ending:

            “Er, I…”

            “No need to justify yourself, John, or your tastes in pornographic materials, for that matter,” Sherlock set the box back down. “Based on the wear of the various pages, I have concluded certain things about your preferences. Not too many variables _there_.” He raised his eyebrows knowingly. “And I would request to perform a number of experiments relating to said preferences, in exchange for my cleaning out the refrigerator.”

            John licked his lips.

            “See, now, who’s really getting the better end of the bargain?”

            “Okay,” John breathed. “Just…give me a minute. Okay.”

            “Deal?”

            He took a few more deep breaths. “Deal.”

 

 

 

2 Humorous ending:

            “Right, well, I…” John flushed.

            “How long were you going to hide this particular hobby from me, John?” Sherlock tutted. “I could have assisted in acquiring specimens for you all along. If you recall, after that money laundering case last month I briefly stopped in Ecuador—well known for its variety of butterfly species.”

            “Okay, okay…”

            “If you let me clean out the refrigerator, you shall also allow me to reorganize your collection in a more suitable display and in a much more sensible order.”

            “Right,” John buried his face in his hands. “Deal.”

            


End file.
